package com.tmt.im.common.pojo;

import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.SuperBuilder;
import org.apache.ignite.cache.query.annotations.QuerySqlField;

import java.io.Serial;
import java.sql.Timestamp;

/**
 * @Description TODO
 * @Author wuyi
 * @Date 2024/9/2 17:58
 * @Version 1.0
 **/
@Getter
@Setter
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
public class BlackBillPoJo implements IGetKey<BlackBillKey> {

    @Serial
    private static final long serialVersionUID = 1194032697806979861L;

    public static final String CACHE_NAME = "black_bill";

    @QuerySqlField(name = "id", index = true)
    private Long id;

    @QuerySqlField(name = "id", index = true)
    @JsonIgnore
    private Long mid;

    /**
     * 被拉入黑名单的用户
     */
    @QuerySqlField(name = "user_id")
    private Long userId;

    /**
     * 聊天群组ID, 不为空时表示本记录是聊天群组的黑名单.
     */
    @QuerySqlField(name = "session_id")
    private Long sessionId;

    @QuerySqlField(name = "creator_id")
    private Long creatorId;

    @QuerySqlField(name = "version")
    private Long version;

    @QuerySqlField(name = "create_time", index = true)
    private Timestamp createTime;

    @JsonIgnore
    private boolean insert;

    @Override
    public BlackBillKey getKey() {
        return new BlackBillKey(id, creatorId);
    }
}

